package com.jerome.election.server.config;

import java.util.HashMap;
import java.util.Map;

/**
 * 配置信息
 *
 * @author Jerome
 * @date 2023/10/18 17:37
 * @version 1.0
 */
public class MemberConfig {
    /**
     * 集群 node 编号 默认1
     */
    private int node = 1;
    /**
     * 议员角色
     */
    private String role = "FOLLOWER";
    /**
     * 日志目录
     * 默认当前运行目录下的logs
     */
    private String logPath = "./logs";
    /**
     * 日志名称
     */
    private String logName = String.format("/%d/member.log",node);
    /**
     * meta data 数据缓存 类似 redis rdb
     */
    private String DBFName = String.format("/%d/memberDBF",node);
    /**
     * DBF 保存时间
     */
    private int DBFTime = 60 * 1000;
    /**
     * 心跳过期时间
     */
    private int heartbeatExpiringTime = 15 * 1000;

    /**
     * leader 统治超时时间
     */
    private int leaderExpiringTime = 5 * 1000;
    /**
     * 保存server节点信息
     */
    private Map<Integer,String> serverMap = new HashMap<>();

    public int getNode() {
        return node;
    }

    public void setNode(int node) {
        this.node = node;
    }

    public String getLogPath() {
        return logPath;
    }

    public void setLogPath(String logPath) {
        this.logPath = logPath;
    }

    public String getLogName() {
        return logName;
    }

    public void setLogName(String logName) {
        this.logName = logName;
    }

    public String getDBFName() {
        return DBFName;
    }

    public void setDBFName(String DBFName) {
        this.DBFName = DBFName;
    }

    public int getDBFTime() {
        return DBFTime;
    }

    public void setDBFTime(int DBFTime) {
        this.DBFTime = DBFTime;
    }

    public int getHeartbeatExpiringTime() {
        return heartbeatExpiringTime;
    }

    public void setHeartbeatExpiringTime(int heartbeatExpiringTime) {
        this.heartbeatExpiringTime = heartbeatExpiringTime;
    }

    public int getLeaderExpiringTime() {
        return leaderExpiringTime;
    }

    public void setLeaderExpiringTime(int leaderExpiringTime) {
        this.leaderExpiringTime = leaderExpiringTime;
    }

    public Map<Integer, String> getServerMap() {
        return serverMap;
    }

    public void setServerMap(Map<Integer, String> serverMap) {
        this.serverMap = serverMap;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }
}
